import request from '@/utils/request'

// 发送消息
export function sendMessage(data) {
  return request({
    url: '/message/send',
    method: 'post',
    data: data
  })
}
export function setMessageStatus(status,ids) {
  return request({
    url: '/message/updateStatus',
    method: 'post',
    data: { ids:ids, status:status }
  })
}
export function readMessage(id) {
  return request({
    url: '/message/read',
    method: 'post',
    data: { ids:[id], status:1 }
  })
}
export function reSendFailMessage(id) {
  return request({
    url: '/message/reSendFail',
    method: 'post',
    data: { id:id}
  })
}
export function reSendMessage(sendId,detailId) {
  return request({
    url: '/message/reSend',
    method: 'post',
    data: { id1: sendId,id2: detailId}
  })
}
export function deleteReceiveMessage(ids) {
  return request({
    url: '/message/deleteReceiveMessage',
    method: 'delete',
    data: { ids: ids }
  })
}
export function deleteSendMessage(ids) {
  return request({
    url: '/message/deleteSendMessage',
    method: 'delete',
    data: { ids: ids }
  })
}
export function homeMessageList() {
  return request({
    url: '/message/homeList',
    method: 'post',
    data: {  }
  })
}

export function messageTemplateCatalog() {
  return request({
    url: '/message/template/allCatalog',
    method: 'get'
  })
}

export function getMessageTemplateById(id) {
  return request({
    url: '/message/template/get',
    method: 'get',
    params: { id: id }
  })
}

export function deleteMessageTemplate(ids) {
  return request({
    url: '/message/template/delete',
    method: 'delete',
    data: { ids: ids }
  })
}
export function saveMessageTemplate(data) {
  return request({
    url: '/message/template/save',
    method: 'post',
    data: data
  })
}
export function sendMessageTemplate(data) {
  return request({
    url: '/message/template/send',
    method: 'post',
    data: data
  })
}
